@ECHO OFF
SETLOCAL

REM 获取传递的参数
SET "SCRIPT_DIR=%~1"
SET "INSTALL_DIR=%~2"
SET "OPENSSL_PREFIX=%~3"

REM 确保参数不为空
IF "%SCRIPT_DIR%"=="" (
    ECHO Script directory not provided.
    EXIT /B 1
)
IF "%INSTALL_DIR%"=="" (
    ECHO Install directory not provided.
    EXIT /B 1
)
IF "%OPENSSL_PREFIX%"=="" (
    ECHO OpenSSL prefix not provided.
    EXIT /B 1
)

REM 运行 configure 命令
ECHO Running configure...
"%SCRIPT_DIR%qt-everywhere-src-5.14.2\configure" -static -prefix "%INSTALL_DIR%" -confirm-license -opensource -debug-and-release -platform win32-msvc -nomake examples -nomake tests -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -ssl -openssl-linked OPENSSL_PREFIX="%OPENSSL_PREFIX%" -skip qtwebengine -skip qtscript
IF %ERRORLEVEL% NEQ 0 (
    ECHO Configuration failed with error code %ERRORLEVEL%
    ECHO Check the output above for more details.
    EXIT /B 1
) ELSE (
    ECHO Configuration succeeded.
    EXIT /B 0
)

ENDLOCAL